package hy.controller;

import hy.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;

@RestController
public class Hello {
    @Autowired
    Environment e;

    @Autowired(required = false)
    Person p;
    @GetMapping("/a")
    public Person a()throws Exception{
        String d = e.getProperty("person.birth");
        System.out.println(d);
        p.setBirth(new SimpleDateFormat("yyyy/MM/dd").parse(d));
        return p;
    }
}
